﻿using NLog;

namespace Enterprises.Wpf.Core.Logs;

/// <summary>
/// NLog 日子帮助类
/// 推荐使用DI构造函数 ILogger log 依赖注册，使用NLog 原始方法输出日志.
/// LogHelper，callsite:className 固定等于="Enterprises.Wpf.Core.Logs.LogHelper.XXX" 
/// </summary>
public static class LogHelper
{
    private static readonly ILogger Logger = LogManager.GetCurrentClassLogger();

    /// <summary>
    /// 记录日志
    /// </summary>
    /// <param name="ex">错误信息</param>
    /// <param name="message">信息</param>
    public static void Error(Exception ex, string message = "") => Logger.Error(ex, message);
    
    /// <summary>
    /// 记录日志
    /// </summary>
    /// <param name="ex">错误信息</param>
    /// <param name="message">信息</param>
    public static void Error(string message,Exception ex) => Logger.Error(ex, message);
    
    /// <summary>
    /// 记录日志
    /// </summary>
    /// <param name="message">信息</param>
    public static void Error(string message) => Logger.Error(message);

    /// <summary>
    /// 记录日志
    /// </summary>
    /// <param name="message">信息</param>
    public static void Info(string message) => Logger.Info(message);

    /// <summary>
    /// 记录日志
    /// </summary>
    /// <param name="message">信息</param>
    public static void Debug(string message) => Logger.Debug(message);

    /// <summary>
    /// 记录日志
    /// </summary>
    /// <param name="message">信息</param>
    public static void Warn(string message) => Logger.Warn(message);

    /// <summary>
    /// 跟踪日志
    /// </summary>
    /// <param name="message">信息</param>
    public static void Trace(string message) => Logger.Trace(message);
}